<?php
$username=$_POST['username'];
$password=$_POST['password'];
$email =$_POST['email'];
// echo $username;
// echo $password;
// die;
include './connect.php';
$sqls="SELECT * FROM `users` WHERE `username`='$username'";
$roo =mysqli_query($link,$sqls);
$ron = mysqli_fetch_assoc($roo);
if($ron){
    $arr=["status"=>1,"msg"=>"账号已存在"];
}
else{
    $sql = "INSERT INTO `users`(`username`,`password`,`email`) VALUE('$username','$password','$email')";
    $row =mysqli_query($link,$sql);
    if($row){
        $arr=["code"=>1,"msg"=>"注册成功"];
    }
    else{
        $arr=["code"=>0,"msg"=>"注册失败"];
    };
}
echo json_encode($arr);